Fix QuickNAT indexed skip connections#9021
Conversation
Signed-off-by: kyinhub <kevinpyin@gmail.com>
📝 WalkthroughWalkthroughQuickNAT’s indexed skip connection now computes its submodule output and supports Estimated code review effort: 2 (Simple) | ~15 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🧹 Nitpick comments (1)
tests/networks/nets/test_quicknat.py (1)
28-33: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winAlign the new test code with Python style rules.
Rename
inputtoinput_tensor(Ruff A002/A001), and expand_DoubleWithIdx.forwardwith Google-styleArgsandReturnssections.Also applies to: 52-56
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@tests/networks/nets/test_quicknat.py` around lines 28 - 33, Update _DoubleWithIdx.forward to rename the input parameter from input to input_tensor and update its usage, then expand the docstring with Google-style Args and Returns sections documenting input_tensor, indices, and the returned tuple.Sources: Path instructions, Linters/SAST tools
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@monai/networks/nets/quicknat.py`:
- Line 58: Update the QuickNat forward path in monai/networks/nets/quicknat.py
at lines 58-58 to pass the existing indices argument to self.submodule instead
of None. Add or update the test in tests/networks/nets/test_quicknat.py at lines
55-63 so _DoubleWithIdx verifies it receives the identical indices object.
In `@tests/networks/nets/test_quicknat.py`:
- Around line 55-63: Update the test around SkipConnectionWithIdx to verify that
the wrapped _DoubleWithIdx submodule receives the original indices argument, not
None. Capture the submodule’s received indices or make it reject None, then
assert object identity against indices in addition to validating the output and
returned indices.
---
Nitpick comments:
In `@tests/networks/nets/test_quicknat.py`:
- Around line 28-33: Update _DoubleWithIdx.forward to rename the input parameter
from input to input_tensor and update its usage, then expand the docstring with
Google-style Args and Returns sections documenting input_tensor, indices, and
the returned tuple.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: 92b60d12-343c-464e-aabc-472d8cd13578
📒 Files selected for processing (2)
monai/networks/nets/quicknat.pytests/networks/nets/test_quicknat.py
Signed-off-by: kyinhub <kevinpyin@gmail.com>
Fixes #7475.
Description
QuickNAT's indexed skip connection now invokes its indexed submodule with the required
(input, indices)signature, forwards the exact incoming index object through the nested indexed path, preserves it for the decoder, supportscat,add, andmulfusion modes, and rejects unsupported modes explicitly.The prior implementation delegated to ordinary
SkipConnection.forward(), which calls its submodule with only the input tensor. QuickNAT's nestedSequentialWithIdxrequires both arguments, sose_block=Nonefailed withSequentialWithIdx.forward() missing ... 'indices'. Existing tests were skipped whenever the optional squeeze-and-excitation package was unavailable, leaving the core path uncovered.The public
se_blockannotation now also reflects the already-supportedNoneconfiguration.Types of changes
./runtests.sh -f -u --net --coverage../runtests.sh --quick --unittests --disttests.make htmlcommand in thedocs/folder.Validation
upstream/devwith the missingindicesargument;git diff --checkpass.